/*
CREDITS:
Sprites - Xim, methinks
Pickup rigged by me.

Sounds:
Up - ?
Fire & Heavy caliber fire - Blizzard (Starcraft 1)
Load, Unload - Westwood (C&C Renegade)
*/

actor Wolgir : Weapon 24504
{
   //$Category Weapons
   //$Title Wolgir
   //$Sprite WLGGX0
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "Snagged a ''Wolgir'' combat rifle! Handy tool for killing tiny cowards! (4)"
   Obituary "%o got caught on napping, so %k pinned %h with ''Wolgir''."
   Weapon.UpSound "Weapons/WolgirUp"
   Weapon.SelectionOrder 5
   Weapon.AmmoType "Boolet"
   Weapon.AmmoType2 "WolgirBeltCounter"
   Weapon.AmmoGive 40
   Weapon.AmmoUse 1
   Weapon.Kickback 25
   Weapon.SlotNumber 4
   Scale 0.9
   +NOAUTOFIRE
   //+ALT_AMMO_OPTIONAL
   +NOALERT
   States
   {
   Ready:
     WLGB A 0 A_TakeInventory("WolgirTrigger",1)
     WLGG A 1 A_WeaponReady
     Loop
   Deselect:
     TNT1 A 0 A_ZoomFactor(1)
     TNT1 A 0 A_StopSoundEx("SoundSlot5")
     WLGG A 1 A_Lower
     WLGG A 0 A_Lower
     Loop
   Select:
     TNT1 A 0 A_JumpIfInventory("WolgirBeltCounter",1,2) //To prevent it from not having any ammo belt.
     TNT1 A 0 A_GiveInventory("WolgirBeltCounter",1)
   Looplet:
     WLGG A 1 A_Raise
     WLGG A 0 A_Raise
     Loop
   Fire:
     TNT1 A 0 A_AlertMonsters
     TNT1 A 0 A_JumpIfInventory("CaliberUpgrade",1,"HFire")

     TNT1 A 0 A_PlaySoundEx("Weapons/WolgirFire","SoundSlot5",1)
     TNT1 A 0 A_GunFlash
     TNT1 A 0 A_JumpIfInventory("WolgirBeltCounter",3,"Fire3")
     TNT1 A 0 A_JumpIfInventory("WolgirBeltCounter",2,"Fire2")
     TNT1 A 1 A_JumpIfInventory("WolgirBeltCounter",1,"Fire1")

   Fire1:
     TNT1 A 0 A_ZoomFactor(0.998)
     TNT1 A 0 A_GiveInventory("BooletCasing")
     TNT1 A 0 A_FireBullets(3, 1, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(3, 1, 1, 20, "BulletPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,12+random(2,-2),4+random(2,5),0)
     Goto Pootis
   Fire2:
     TNT1 A 0 A_ZoomFactor(0.996)
     TNT1 A 0 A_GiveInventory("BooletCasing",2)
     TNT1 A 0 A_FireBullets(5, 2, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(5, 2, 1, 20, "BulletPuff", 0)
     TNT1 A 0 A_FireBullets(5, 2, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(5, 2, 1, 20, "BulletPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,16+random(2,-2),8+random(2,5),0)
     Goto Pootis
   Fire3:
     TNT1 A 0 A_ZoomFactor(0.994)
     TNT1 A 0 A_GiveInventory("BooletCasing",3)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 0)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 0)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 20, "BulletPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),12+random(2,5),0)
     Goto Pootis
   Pootis:
     WLGF A 1 Bright
     WLGG B 1 ACS_Execute(851,0,-2,-2+random(-1,-2),0)
     TNT1 A 0 A_ZoomFactor(1)
     WLGG CD 1 ACS_Execute(851,0,-1,0,0)
     WLGG A 0 A_ReFire
     Goto FireStop
   FireStop:
     WLGG EF 1
     WLGG A 2 A_PlaySoundEx("Weapons/WolgirEndFire","SoundSlot5")
     WLGG A 10
     goto Ready

   HFire:
     TNT1 A 0 A_PlaySoundEx("Weapons/WolgirHFire","SoundSlot5",1)
     TNT1 A 0 A_GunFlash
     TNT1 A 0 A_JumpIfInventory("WolgirBeltCounter",3,"HFire3")
     TNT1 A 0 A_JumpIfInventory("WolgirBeltCounter",2,"HFire2")
     TNT1 A 1 A_JumpIfInventory("WolgirBeltCounter",1,"HFire1")

   HFire1:
     TNT1 A 0 A_ZoomFactor(0.998)
     TNT1 A 0 A_GiveInventory("BooletCasing")
     TNT1 A 0 A_FireBullets(3, 1, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(3, 1, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,12+random(2,-2),4+random(2,5),0)
     Goto Bootis
   HFire2:
     TNT1 A 0 A_ZoomFactor(0.996)
     TNT1 A 0 A_GiveInventory("BooletCasing",2)
     TNT1 A 0 A_FireBullets(5, 2, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(5, 2, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 A_FireBullets(5, 2, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(5, 2, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,16+random(2,-2),8+random(2,5),0)
     Goto Bootis
   HFire3:
     TNT1 A 0 A_ZoomFactor(0.994)
     TNT1 A 0 A_GiveInventory("BooletCasing",3)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 1)
     TNT1 A 0 A_FireBullets(7, 3, 1, 40, "CaliberPuff", 0)
     TNT1 A 0 ACS_Execute(851,0,20+random(2,-2),12+random(2,5),0)
     Goto Bootis
   Bootis:
     WLGF A 1 Bright
     WLGG B 1 ACS_Execute(851,0,-2,-2+random(-1,-2),0)
     TNT1 A 0 A_ZoomFactor(1)
     WLGG CD 1 ACS_Execute(851,0,-1,0,0)
     WLGG A 0 A_ReFire
     Goto HFireStop
   HFireStop:
     WLGG EF 1
     WLGG A 2 A_PlaySoundEx("Weapons/WolgirHEndFire","SoundSlot5")
     WLGG A 10
     goto Ready

   AltFire:
     WLGG A 0 A_JumpIfInventory("WolgirTrigger",1,"Unload")
     WLGB A 0 A_GiveInventory("WolgirTrigger",1)
     WLGG A 10 A_WeaponReady(WRF_NoBob|WRF_NoPrimary)

   Load:
     WLGG A 0 A_JumpIfInventory("WolgirBeltCounter",0,"Ready")
     WLGB A 0 A_TakeInventory("WolgirTrigger",1)
     WLGG A 2
     WLGB ABCDEFGHI 1
     WLGB A 0 A_GiveInventory("WolgirBeltCounter",1)
     WLGB I 0 A_PlayWeaponSound("Weapons/WolgirBeltIn")
     WLGB JKLMNO 1
     WLGG A 3
     WLGG A 0 A_ReFire("Load")
     Goto Ready
   UnLoad:
     WLGG A 0 A_JumpIfInventory("WolgirBeltCounter",2,1)
     Goto Ready
     WLGB A 0
     WLGB A 0 A_TakeInventory("WolgirTrigger",1)
     WLGG A 2
     WLGB ONMLKJ 1
     WLGB A 0 A_TakeInventory("WolgirBeltCounter",1)
     WLGB I 0 A_PlayWeaponSound("Weapons/WolgirBeltOut")
     WLGB IHGFEDCBA 1
     WLGG A 3
     WLGG A 0 A_ReFire("UnLoad")
     Goto Ready
   AltFlash:
     TNT1 A 3 Bright A_Light1
     Goto LightDone
   Spawn:
     WLGG X -1
     Stop
   }
}

ACTOR WolgirBeltCounter : Ammo
{
 Inventory.MaxAmount 3
 Inventory.Icon "WLGGX0"
}

ACTOR WolgirTrigger : Inventory
{
 Inventory.MaxAmount 1
}
